package com.cicadasmall.common.base;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * BaseService
 *
 * @author Jin
 */
public class BaseService<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {

    public LambdaQueryWrapper<T> getLambdaQueryWrapper() {
        return new LambdaQueryWrapper<>();
    }

    public LambdaQueryWrapper<T> getLambdaQueryWrapper(T t) {
        return new LambdaQueryWrapper<>(t);
    }

    public List<T> findAll() {
        return baseMapper.selectList(Wrappers.emptyWrapper());
    }

}
